using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XFGameFramework;
using UnityEngine.UI;
public class LoadingPanel : Panel
{
    #region 字段
    [SerializeField]
    private Slider slider_progress;
    float targetProgress;
    #endregion
    #region 重写方法
    public override void OnLoaded(params object[] param)
    {
        base.OnLoaded(param);
        UpdateProgress(0);
        slider_progress.value = 0;
    }
    #endregion
    #region 方法
    public void UpdateProgress(float progress)
    {
        targetProgress = progress;
    }
    public bool isDone()
    {
        return slider_progress.value >= 1;
    }
    #endregion
    #region 生命周期
    private void Update()
    {
        if (slider_progress.value <= targetProgress)
        {
            slider_progress.value += Time.deltaTime;
        }
        #endregion
    }
}